*************************
***Motivated Reasoning***
****Replication File*****
*************************
version 14.2
set more off

*In-Text Tables
*Reagan-Bush
sureg (inpartydf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar) /// 
(outpartydf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar) ///  
(inddf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar) if reaganbush==1

*Clinton
sureg (inpartydf L(0/1).bus5yrdf pki2 ) /// 
(outpartydf L(0/1).bus5yrdf pki2 ) ///  
(inddf  L(0/1).bus5yrdf pki2 ) if clinton==1

*Bush2
sureg (inpartydf L(0/1).bus5yrdf w1 w3 casualties pki5  pki7) /// 
(outpartydf L(0/1).bus5yrdf  w1 w3 casualties pki5  pki7) /// 
(inddf L(0/1).bus5yrdf  w1 w3 casualties pki5  pki7) if gwb==1
  
*Obama
sureg (inpartydf L(0/1).bus5yrdf pki9) /// 
(outpartydf  L(0/1).bus5yrdf pki9) ///  
(inddf  L(0/1).bus5yrdf pki9) if obama==1

**Appendix Tables - objective eco. indicators
*Reagan-Bush
sureg (inpartydf L(0/1)d.cpi L(0/1)d.unemp L(-5/-4).gulfwar L(0/1).gulfwar) /// 
(outpartydf L(0/1)d.cpi L(0/1)d.unemp L(-5/-4).gulfwar L(0/1).gulfwar) ///  
(inddf L(0/1)d.cpi L(0/1)d.unemp L(-5/-4).gulfwar L(0/1).gulfwar) if reaganbush==1
wntestq inpartydf, lags(20)
wntestq outpartydf, lags(20)
wntestq inddf, lags(20)

*Clinton
*first differences
sureg (inpartydf L(0/1)d.cpi L(0/1)d.unemp pki2) /// 
(outpartydf L(0/1)d.cpi L(0/1)d.unemp pki2) ///  
(inddf L(0/1)d.cpi L(0/1)d.unemp pki2) if clinton==1
wntestq inpartydf, lags(20)
wntestq outpartydf, lags(20)
wntestq inddf, lags(20)
  
*Bush2
sureg (inpartydf L(0/1)d.cpi L(0/1)d.unemp w1 w3 casualties pki5  pki7) /// 
(outpartydf L(0/1)d.cpi L(0/1)d.unemp w1 w3 casualties pki5  pki7) /// 
(inddf L(0/1)d.cpi L(0/1)d.unemp w1 w3 casualties pki5  pki7) if gwb==1
wntestq inpartydf, lags(20)
wntestq outpartydf, lags(20)
wntestq inddf, lags(20)

*Obama
sureg (inpartydf L(0/1)d.cpi L(0/1)d.unemp pki9) /// 
(outpartydf L(0/1)d.cpi L(0/1)d.unemp pki9) ///  
(inddf L(0/1)d.cpi L(0/1)d.unemp pki9) if obama==1
wntestq inpartydf, lags(20)
wntestq outpartydf, lags(20)
wntestq inddf, lags(20)

sureg (inpartydf L(0/1)d.cpi L(0/1)d.unemp pki9) /// 
(outpartydf L(0/1)d.cpi L(0/1)d.unemp pki9) ///  
(inddf L(0/1)d.cpi L(0/1)d.unemp pki9) if year>2009
wntestq inpartydf, lags(20)
wntestq outpartydf, lags(20)
wntestq inddf, lags(20)


*In-Text Graphs
set scheme lean2

rolling _b, window(48): sureg (inpartydf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar pki2 pki5  pki7 pki9) /// 
(outpartydf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar pki2 pki5  pki7 pki9) ///  
(inddf L(0/1).bus5yrdf L(-5/-4).gulfwar L(0/1).gulfwar pki2 pki5  pki7 pki9)

gen combined_in = inpartydf_b_bus5yrdf + _stat_2
line combined_in end

gen combined_out = outpartydf_b_bus5yrdf + _stat_13
line combined_out end

line combined_in end, legend(label(1 "In-Party")) || line combined_out end, /// 
xtitle("Year") ytitle("Correlation with Business Expectations", height(-10)) /// 
xlabel(384 "1985" 408 "1987" 432 "1989" 456 "1991" /// 
480 "1993" 504 "1995" 528 "1997" 552 "1999" 576 "2001" 600 "2003" 624 "2004" /// 
648 "2007" 672 "2009" 696 "2011" 720 "2013" 744 "2015", angle(45)) /// 
legend(position(2) ring(0) label(2 "Out-Party"))

gen combined_indep = inddf_b_bus5yrdf + _stat_24

line combined_indep end, /// 
xtitle("Year") ytitle("Correlation with Business Expectations", height(-10)) /// 
xlabel(384 "1985" 408 "1987" 432 "1989" 456 "1991" /// 
480 "1993" 504 "1995" 528 "1997" 552 "1999" 576 "2001" 600 "2003" 624 "2004" /// 
648 "2007" 672 "2009" 696 "2011" 720 "2013" 744 "2015", angle(45)) /// 
legend(position(2) ring(0))

